﻿using J.Status.Application.Command.RoomNumCommand;
using J.StatusModel;
using J.StatusModel.Dto;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using StatusDto;
using StatusService;

namespace J.Status.Controllers
{
    /// <summary>
    /// 房号管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RoomNumController : ControllerBase
    {
        private readonly IMediator mediator;
        public RoomNumController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 房号添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> RoomNumAdd(RoomNumCreateCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 显示分页
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageDto<RoomNumDto>> RoomNumShow(RoomNumSelectCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 房态显示
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageDto<RoomNumDto>> RoomStatusShow2(RoomNumSelect2Command command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> RoomNumDelete(RoomNumDeleteCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 回显
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<RoomNumManage> RoomNumFill(RoomNumFillCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<int> RoomNumUpdate(RoomNumUpdateCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 批量下架
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> RoomNumUpdateAll(RoomNumUpdateAllCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> RoomNumDeleteAll(RoomNumDeleteAllCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 上下架
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> RoomNumUpdateS(RoomNumUpdateSCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 房态查询
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<List<RoomNumManage>> RoomStateShow(RoomStateSelectCommand command)
        {
            return await mediator.Send(command);
        }
    }
}
